﻿/*
 * Created by SharpDevelop.
 * User: IEscarro
 * Date: 9/4/2009
 * Time: 9:28 AM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.Collections.Generic;
using PilotFish.Model.Dao;

namespace PilotFish.Model
{
	/// <summary>
	/// Description of SessionFacade.
	/// </summary>
	public class SessionFacade
	{
		public SessionFacade()
		{
		}
		
		public static void SaveOrUpdateAllergy(Allergy a)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateAllergyDao().SaveOrUpdate(a);
		}
		
		public static void SaveOrUpdateDoctor(Doctor d)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateDoctorDao().SaveOrUpdate(d);
		}
		
		public static void SaveOrUpdateToDo(ToDo t)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateToDoDao().SaveOrUpdate(t);
		}
		
		public static void SaveOrUpdateClinic(Clinic c)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateClinicDao().SaveOrUpdate(c);
		}
		
		public static void SaveOrUpdatePatient(Patient p)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreatePatientDao().SaveOrUpdate(p);
		}
		
		public static Clinic ReadClinicByPk(int id)
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateClinicDao().ReadByPk(id);
		}
		
		public static User ReadUserByNameAndPassword(string name, string password)
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateUserDao().ReadByNameAndPassword(name, password);
		}
		
		public static IList<Patient> FindAllPatients()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreatePatientDao().FindAll();
		}
		
		public static IList<Doctor> FindAllDoctors()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateDoctorDao().FindAll();
		}
		
		public static IList<ToDo> FindAllToDos()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateToDoDao().FindAll();
		}
	}
}
